<template>
  <CraneForm ref="craneForm" :schema="data.schema" @form-submit="submit" />
</template>

<script setup lang="ts">
import { CraneForm } from 'crane-element';

import { reactive } from 'vue';
import { CraneSchema } from 'crane-element/lib/components/CraneForm/types';

const data = reactive({
  schema: {
    properties: {
      nickname: {
        type: 'string',
        title: '昵称'
      },
      phone: {
        type: 'string',
        title: '手机号'
      },
      password: {
        type: 'password',
        title: '密码'
      },
      confirmPassword: {
        type: 'password',
        title: '确认密码'
      }
    },
    required: ['nickname', 'phone', 'password', 'confirmPassword']
  } as CraneSchema
});

const props = defineProps({
  close: {
    type: Function,
    required: true
  }
});

const submit = (e: any) => {
  props.close(e);
};
</script>

<style scoped lang="less"></style>
